package ilbunilcho.lol.main;

import java.util.HashMap;
import java.util.Iterator;

import org.apache.log4j.Logger;

public enum LOL_Server {	
	info(new HashMap<String, String[][]>() {
		private static final long serialVersionUID = -131119873429112903L;

		{
			put("na", new String[][] {
					{ "North America", "English", "http://na.leagueoflegends.com" }
				});
			put("euw", new String[][] {
					{ "EU West", "English", "http://euw.leagueoflegends.com/en" },
					{ "EU West", "Deutsch", "http://euw.leagueoflegends.com/de" },
					{ "EU West", "Español", "http://euw.leagueoflegends.com/es" },
					{ "EU West", "Français", "http://euw.leagueoflegends.com/fr" }
				});
			put("eune", new String[][] {
					{ "EU Nordic & East", "English", "http://eune.leagueoflegends.com/en" },
					{ "EU Nordic & East", "Polski", "http://eune.leagueoflegends.com/pl" }
				});
		}
	});
	
	Logger log = Logger.getLogger(LOL_Server.class);

	HashMap<String, String[][]> map;

	LOL_Server(HashMap<String, String[][]> info) {
		this.map = info;
	}

	String[][] getServer() {
		String[][] ret = new String[map.keySet().size()][2];
		Iterator<String> iter = map.keySet().iterator();

		int cnt = 0;
		while(iter.hasNext()) {
			String key = iter.next();
			String val = map.get(key)[0][0];
			ret[cnt][0] = key;
			ret[cnt][1] = val;
			cnt++;
			
			log.debug("key : " + key);
			log.debug("val : " + val);
		}
		
		return ret;
	}
	
	String[] getLanguage(String region) {
		String[][] info = map.get(region);
		String[] ret = new String[info.length];
		for(int i=0; i<info.length; i++) {
			ret[i] = info[i][1];
			
			log.debug("ret["+i+"] : " + ret[i]);
		}
		
		return ret;
	}
	
	public static void main(String[] args) {
		System.out.println(LOL_Server.info.getServer().length);
		System.out.println(LOL_Server.info.getLanguage("euw")[0]);
		System.out.println(LOL_Server.info.getLanguage("euw")[1]);
		System.out.println(LOL_Server.info.getLanguage("euw")[2]);
	}
}
